package eval.host;

import java.util.ArrayList;
import java.util.List;

import eval.utilities.configuration.ExperimentConfiguration;

public class HostGenerator {
	
	protected ExperimentConfiguration configuration = ExperimentConfiguration.getSingleton();
	private IHostManager hostManager;
	
	
	public HostGenerator(IHostManager hostManager) {
		this.hostManager = hostManager;
	}
	
	public Host generateNewHost() {
		for (HostCapacityEnum value : HostCapacityEnum.values()) {
			return new Host(value,hostManager.getHostCapacity(value),configuration.hostCounter++);
		}
		throw new IllegalArgumentException("Error while generating a new host");
	}

	public List<Host> generateHosts(int totalNumberOfHosts) {
		List<Host> hostList = new ArrayList<Host>();
		
		for (int i = 0; i < totalNumberOfHosts; i++)
			hostList.add(generateNewHost());
		
		return hostList;
	}

}
